home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / gdb.info-6 < prev    next >
Encoding:
Text File  |  1992-04-11  |  33.4 KB  |  842 lines

  1. Info file ./gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb: (gdb).                   The GNU debugger.
  6. END-INFO-DIR-ENTRY
  7.    This file documents the GNU debugger GDB.
  8.  
  9.    This is Edition 4.04, March 1992, of `Using GDB: A Guide to the GNU
  10. Source-Level Debugger' for GDB Version 4.5.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software
  13. Foundation, Inc.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of
  16. this manual provided the copyright notice and this permission notice
  17. are preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided also
  21. that the section entitled "GNU General Public License" is included
  22. exactly as in the original, and provided that the entire resulting
  23. derived work is distributed under the terms of a permission notice
  24. identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that the section entitled "GNU General Public
  29. License" may be included in a translation approved by the Free
  30. Software Foundation instead of in the original English.
  31.  
  32. 
  33. File: gdb.info,  Node: Output,  Prev: Command Files,  Up: Sequences
  34.  
  35. Commands for Controlled Output
  36. ==============================
  37.  
  38.    During the execution of a command file or a user-defined command,
  39. normal GDB output is suppressed; the only output that appears is what
  40. is explicitly printed by the commands in the definition.  This section
  41. describes three commands useful for generating exactly the output you
  42. want.
  43.  
  44. `echo TEXT'
  45.      Print TEXT.  Nonprinting characters can be included in TEXT using
  46.      C escape sequences, such as `\n' to print a newline.  *No newline
  47.      will be printed unless you specify one.* In addition to the
  48.      standard C escape sequences, a backslash followed by a space
  49.      stands for a space.  This is useful for outputting a string with
  50.      spaces at the beginning or the end, since leading and trailing
  51.      spaces are otherwise trimmed from all arguments.  To print ` and
  52.      foo = ', use the command `echo \ and foo = \ '.
  53.  
  54.      A backslash at the end of TEXT can be used, as in C, to continue
  55.      the command onto subsequent lines.  For example,
  56.  
  57.           echo This is some text\n\
  58.           which is continued\n\
  59.           onto several lines.\n
  60.  
  61.      produces the same output as
  62.  
  63.           echo This is some text\n
  64.           echo which is continued\n
  65.           echo onto several lines.\n
  66.  
  67. `output EXPRESSION'
  68.      Print the value of EXPRESSION and nothing but that value: no
  69.      newlines, no `$NN = '.  The value is not entered in the value
  70.      history either.  *Note Expressions: Expressions, for more
  71.      information on expressions.
  72.  
  73. `output/FMT EXPRESSION'
  74.      Print the value of EXPRESSION in format FMT.  You can use the
  75.      same formats as for `print'; *note Output formats::., for more
  76.      information.
  77.  
  78. `printf STRING, EXPRESSIONS...'
  79.      Print the values of the EXPRESSIONS under the control of STRING. 
  80.      The EXPRESSIONS are separated by commas and may be either numbers
  81.      or pointers.  Their values are printed as specified by STRING,
  82.      exactly as if your program were to execute
  83.  
  84.           printf (STRING, EXPRESSIONS...);
  85.  
  86.      For example, you can print two values in hex like this:
  87.  
  88.           printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  89.  
  90.      The only backslash-escape sequences that you can use in the format
  91.      string are the simple ones that consist of backslash followed by a
  92.      letter.
  93.  
  94. 
  95. File: gdb.info,  Node: Emacs,  Next: GDB Bugs,  Prev: Sequences,  Up: Top
  96.  
  97. Using GDB under GNU Emacs
  98. *************************
  99.  
  100.    A special interface allows you to use GNU Emacs to view (and edit)
  101. the source files for the program you are debugging with GDB.
  102.  
  103.    To use this interface, use the command `M-x gdb' in Emacs.  Give the
  104. executable file you want to debug as an argument.  This command starts
  105. GDB as a subprocess of Emacs, with input and output through a newly
  106. created Emacs buffer.
  107.  
  108.    Using GDB under Emacs is just like using GDB normally except for two
  109. things:
  110.  
  111.    * All "terminal" input and output goes through the Emacs buffer.
  112.  
  113.    This applies both to GDB commands and their output, and to the input
  114. and output done by the program you are debugging.
  115.  
  116.    This is useful because it means that you can copy the text of
  117. previous commands and input them again; you can even use parts of the
  118. output in this way.
  119.  
  120.    All the facilities of Emacs' Shell mode are available for
  121. interacting with your program.  In particular, you can send signals
  122. the usual way--for example, `C-c C-c' for an interrupt, `C-c C-z' for a
  123. stop.
  124.  
  125.    * GDB displays source code through Emacs.
  126.  
  127.    Each time GDB displays a stack frame, Emacs automatically finds the
  128. source file for that frame and puts an arrow (`=>') at the left margin
  129. of the current line.  Emacs uses a separate buffer for source display,
  130. and splits the window to show both your GDB session and the source.
  131.  
  132.    Explicit GDB `list' or search commands still produce output as
  133. usual, but you probably will have no reason to use them.
  134.  
  135.      *Warning:* If the directory where your program resides is not your
  136.      current directory, it can be easy to confuse Emacs about the
  137.      location of the source files, in which case the auxiliary display
  138.      buffer will not appear to show your source.  GDB can find
  139.      programs by searching your environment's `PATH' variable, so the
  140.      GDB input and output session will proceed normally; but Emacs
  141.      does not get enough information back from GDB to locate the
  142.      source files in this situation.  To avoid this problem, either
  143.      start GDB mode from the directory where your program resides, or
  144.      specify a full path name when prompted for the `M-x gdb' argument.
  145.  
  146.      A similar confusion can result if you use the GDB `file' command
  147.      to switch to debugging a program in some other location, from an
  148.      existing GDB buffer in Emacs.
  149.  
  150.    By default, `M-x gdb' calls the program called `gdb'.  If you need
  151. to call GDB by a different name (for example, if you keep several
  152. configurations around, with different names) you can set the Emacs
  153. variable `gdb-command-name'; for example,
  154.  
  155.      (setq gdb-command-name "mygdb")
  156.  
  157. (preceded by `ESC ESC', or typed in the `*scratch*' buffer, or in your
  158. `.emacs' file) will make Emacs call the program named "`mygdb'"
  159. instead.
  160.  
  161.    In the GDB I/O buffer, you can use these special Emacs commands in
  162. addition to the standard Shell mode commands:
  163.  
  164. `C-h m'
  165.      Describe the features of Emacs' GDB Mode.
  166.  
  167. `M-s'
  168.      Execute to another source line, like the GDB `step' command; also
  169.      update the display window to show the current file and location.
  170.  
  171. `M-n'
  172.      Execute to next source line in this function, skipping all
  173.      function calls, like the GDB `next' command.  Then update the
  174.      display window to show the current file and location.
  175.  
  176. `M-i'
  177.      Execute one instruction, like the GDB `stepi' command; update
  178.      display window accordingly.
  179.  
  180. `M-x gdb-nexti'
  181.      Execute to next instruction, using the GDB `nexti' command; update
  182.      display window accordingly.
  183.  
  184. `C-c C-f'
  185.      Execute until exit from the selected stack frame, like the GDB
  186.      `finish' command.
  187.  
  188. `M-c'
  189.      Continue execution of your program, like the GDB `continue'
  190.      command.
  191.  
  192.      *Warning:* In Emacs v19, this command is `C-c C-p'.
  193.  
  194. `M-u'
  195.      Go up the number of frames indicated by the numeric argument
  196.      (*note Numeric Arguments: (emacs)Arguments.), like the GDB `up'
  197.      command.
  198.  
  199.      *Warning:* In Emacs v19, this command is `C-c C-u'.
  200.  
  201. `M-d'
  202.      Go down the number of frames indicated by the numeric argument,
  203.      like the GDB `down' command.
  204.  
  205.      *Warning:* In Emacs v19, this command is `C-c C-d'.
  206.  
  207. `C-x &'
  208.      Read the number where the cursor is positioned, and insert it at
  209.      the end of the GDB I/O buffer.  For example, if you wish to
  210.      disassemble code around an address that was displayed earlier,
  211.      type `disassemble'; then move the cursor to the address display,
  212.      and pick up the argument for `disassemble' by typing `C-x &'.
  213.  
  214.      You can customize this further on the fly by defining elements of
  215.      the list `gdb-print-command'; once it is defined, you can format
  216.      or otherwise process numbers picked up by `C-x &' before they are
  217.      inserted.  A numeric argument to `C-x &' will both indicate that
  218.      you wish special formatting, and act as an index to pick an
  219.      element of the list.  If the list element is a string, the number
  220.      to be inserted is formatted using the Emacs function `format';
  221.      otherwise the number is passed as an argument to the
  222.      corresponding list element.
  223.  
  224.    In any source file, the Emacs command `C-x SPC' (`gdb-break') tells
  225. GDB to set a breakpoint on the source line point is on.
  226.  
  227.    If you accidentally delete the source-display buffer, an easy way
  228. to get it back is to type the command `f' in the GDB buffer, to
  229. request a frame display; when you run under Emacs, this will recreate
  230. the source buffer if necessary to show you the context of the current
  231. frame.
  232.  
  233.    The source files displayed in Emacs are in ordinary Emacs buffers
  234. which are visiting the source files in the usual way.  You can edit
  235. the files with these buffers if you wish; but keep in mind that GDB
  236. communicates with Emacs in terms of line numbers.  If you add or
  237. delete lines from the text, the line numbers that GDB knows will cease
  238. to correspond properly to the code.
  239.  
  240. 
  241. File: gdb.info,  Node: GDB Bugs,  Next: Renamed Commands,  Prev: Emacs,  Up: Top
  242.  
  243. Reporting Bugs in GDB
  244. *********************
  245.  
  246.    Your bug reports play an essential role in making GDB reliable.
  247.  
  248.    Reporting a bug may help you by bringing a solution to your
  249. problem, or it may not.  But in any case the principal function of a
  250. bug report is to help the entire community by making the next version
  251. of GDB work better.  Bug reports are your contribution to the
  252. maintenance of GDB.
  253.  
  254.    In order for a bug report to serve its purpose, you must include the
  255. information that enables us to fix the bug.
  256.  
  257. * Menu:
  258.  
  259. * Bug Criteria::                Have You Found a Bug?
  260. * Bug Reporting::               How to Report Bugs
  261.  
  262. 
  263. File: gdb.info,  Node: Bug Criteria,  Next: Bug Reporting,  Prev: GDB Bugs,  Up: GDB Bugs
  264.  
  265. Have You Found a Bug?
  266. =====================
  267.  
  268.    If you are not sure whether you have found a bug, here are some
  269. guidelines:
  270.  
  271.    * If the debugger gets a fatal signal, for any input whatever, that
  272.      is a GDB bug.  Reliable debuggers never crash.
  273.  
  274.    * If GDB produces an error message for valid input, that is a bug.
  275.  
  276.    * If GDB does not produce an error message for invalid input, that
  277.      is a bug.  However, you should note that your idea of "invalid
  278.      input" might be our idea of "an extension" or "support for
  279.      traditional practice".
  280.  
  281.    * If you are an experienced user of debugging tools, your
  282.      suggestions for improvement of GDB are welcome in any case.
  283.  
  284. 
  285. File: gdb.info,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: GDB Bugs
  286.  
  287. How to Report Bugs
  288. ==================
  289.  
  290.    A number of companies and individuals offer support for GNU
  291. products.  If you obtained GDB from a support organization, we
  292. recommend you contact that organization first.
  293.  
  294.    Contact information for many support companies and individuals is
  295. available in the file `etc/SERVICE' in the GNU Emacs distribution.
  296.  
  297.    In any event, we also recommend that you send bug reports for GDB
  298. to one of these addresses:
  299.  
  300.      bug-gdb@prep.ai.mit.edu
  301.      {ucbvax|mit-eddie|uunet}!prep.ai.mit.edu!bug-gdb
  302.  
  303.    *Do not send bug reports to `info-gdb', or to `help-gdb', or to any
  304. newsgroups.* Most users of GDB do not want to receive bug reports. 
  305. Those that do, have arranged to receive `bug-gdb'.
  306.  
  307.    The mailing list `bug-gdb' has a newsgroup `gnu.gdb.bug' which
  308. serves as a repeater.  The mailing list and the newsgroup carry exactly
  309. the same messages.  Often people think of posting bug reports to the
  310. newsgroup instead of mailing them.  This appears to work, but it has
  311. one problem which can be crucial: a newsgroup posting often lacks a
  312. mail path back to the sender.  Thus, if we need to ask for more
  313. information, we may be unable to reach you.  For this reason, it is
  314. better to send bug reports to the mailing list.
  315.  
  316.    As a last resort, send bug reports on paper to:
  317.  
  318.      GNU Debugger Bugs
  319.      Free Software Foundation
  320.      545 Tech Square
  321.      Cambridge, MA 02139
  322.  
  323.    The fundamental principle of reporting bugs usefully is this:
  324. *report all the facts*.  If you are not sure whether to state a fact
  325. or leave it out, state it!
  326.  
  327.    Often people omit facts because they think they know what causes the
  328. problem and assume that some details do not matter.  Thus, you might
  329. assume that the name of the variable you use in an example does not
  330. matter.  Well, probably it does not, but one cannot be sure.  Perhaps
  331. the bug is a stray memory reference which happens to fetch from the
  332. location where that name is stored in memory; perhaps, if the name
  333. were different, the contents of that location would fool the debugger
  334. into doing the right thing despite the bug.  Play it safe and give a
  335. specific, complete example.  That is the easiest thing for you to do,
  336. and the most helpful.
  337.  
  338.    Keep in mind that the purpose of a bug report is to enable us to fix
  339. the bug if it is new to us.  It is not as important as what happens if
  340. the bug is already known.  Therefore, always write your bug reports on
  341. the assumption that the bug has not been reported previously.
  342.  
  343.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  344. bell?"  Those bug reports are useless, and we urge everyone to *refuse
  345. to respond to them* except to chide the sender to report bugs properly.
  346.  
  347.    To enable us to fix the bug, you should include all these things:
  348.  
  349.    * The version of GDB.  GDB announces it if you start with no
  350.      arguments; you can also print it at any time using `show version'.
  351.  
  352.      Without this, we will not know whether there is any point in
  353.      looking for the bug in the current version of GDB.
  354.  
  355.    * The type of machine you are using, and the operating system name
  356.      and version number.
  357.  
  358.    * What compiler (and its version) was used to compile GDB--e.g. 
  359.      "gcc-2.0".
  360.  
  361.    * What compiler (and its version) was used to compile the program
  362.      you are debugging--e.g.  "gcc-2.0".
  363.  
  364.    * The command arguments you gave the compiler to compile your
  365.      example and observe the bug.  For example, did you use `-O'?  To
  366.      guarantee you will not omit something important, list them all. 
  367.      A copy of the Makefile (or the output from make) is sufficient.
  368.  
  369.      If we were to try to guess the arguments, we would probably guess
  370.      wrong and then we might not encounter the bug.
  371.  
  372.    * A complete input script, and all necessary source files, that will
  373.      reproduce the bug.
  374.  
  375.    * A description of what behavior you observe that you believe is
  376.      incorrect.  For example, "It gets a fatal signal."
  377.  
  378.      Of course, if the bug is that GDB gets a fatal signal, then we
  379.      will certainly notice it.  But if the bug is incorrect output, we
  380.      might not notice unless it is glaringly wrong.  We are human,
  381.      after all.  You might as well not give us a chance to make a
  382.      mistake.
  383.  
  384.      Even if the problem you experience is a fatal signal, you should
  385.      still say so explicitly.  Suppose something strange is going on,
  386.      such as, your copy of GDB is out of synch, or you have
  387.      encountered a bug in the C library on your system.  (This has
  388.      happened!)  Your copy might crash and ours would not.  If you
  389.      told us to expect a crash, then when ours fails to crash, we
  390.      would know that the bug was not happening for us.  If you had not
  391.      told us to expect a crash, then we would not be able to draw any
  392.      conclusion from our observations.
  393.  
  394.    * If you wish to suggest changes to the GDB source, send us context
  395.      diffs.  If you even discuss something in the GDB source, refer to
  396.      it by context, not by line number.
  397.  
  398.      The line numbers in our development sources will not match those
  399.      in your sources.  Your line numbers would convey no useful
  400.      information to us.
  401.  
  402.    Here are some things that are not necessary:
  403.  
  404.    * A description of the envelope of the bug.
  405.  
  406.      Often people who encounter a bug spend a lot of time investigating
  407.      which changes to the input file will make the bug go away and
  408.      which changes will not affect it.
  409.  
  410.      This is often time consuming and not very useful, because the way
  411.      we will find the bug is by running a single example under the
  412.      debugger with breakpoints, not by pure deduction from a series of
  413.      examples.  We recommend that you save your time for something
  414.      else.
  415.  
  416.      Of course, if you can find a simpler example to report *instead*
  417.      of the original one, that is a convenience for us.  Errors in the
  418.      output will be easier to spot, running under the debugger will
  419.      take less time, etc.
  420.  
  421.      However, simplification is not vital; if you do not want to do
  422.      this, report the bug anyway and send us the entire test case you
  423.      used.
  424.  
  425.    * A patch for the bug.
  426.  
  427.      A patch for the bug does help us if it is a good one.  But do not
  428.      omit the necessary information, such as the test case, on the
  429.      assumption that a patch is all we need.  We might see problems
  430.      with your patch and decide to fix the problem another way, or we
  431.      might not understand it at all.
  432.  
  433.      Sometimes with a program as complicated as GDB it is very hard to
  434.      construct an example that will make the program follow a certain
  435.      path through the code.  If you do not send us the example, we
  436.      will not be able to construct one, so we will not be able to
  437.      verify that the bug is fixed.
  438.  
  439.      And if we cannot understand what bug you are trying to fix, or
  440.      why your patch should be an improvement, we will not install it. 
  441.      A test case will help us to understand.
  442.  
  443.    * A guess about what the bug is or what it depends on.
  444.  
  445.      Such guesses are usually wrong.  Even we cannot guess right about
  446.      such things without first using the debugger to find the facts.
  447.  
  448. 
  449. File: gdb.info,  Node: Renamed Commands,  Next: Formatting Documentation,  Prev: GDB Bugs,  Up: Top
  450.  
  451. Renamed Commands
  452. ****************
  453.  
  454.    The following commands were renamed in GDB 4, in order to make the
  455. command set as a whole more consistent and easier to use and remember:
  456.  
  457.      OLD COMMAND               NEW COMMAND
  458.      ---------------           -------------------------------
  459.      add-syms                  add-symbol-file
  460.      delete environment        unset environment
  461.      info convenience          show convenience
  462.      info copying              show copying
  463.      info directories          show directories
  464.      info editing              show commands
  465.      info history              show values
  466.      info targets              help target
  467.      info values               show values
  468.      info version              show version
  469.      info warranty             show warranty
  470.      set/show addressprint     set/show print address
  471.      set/show array-max        set/show print elements
  472.      set/show arrayprint       set/show print array
  473.      set/show asm-demangle     set/show print asm-demangle
  474.      set/show caution          set/show confirm
  475.      set/show demangle         set/show print demangle
  476.      set/show history write    set/show history save
  477.      set/show prettyprint      set/show print pretty
  478.      set/show screen-height    set/show height
  479.      set/show screen-width     set/show width
  480.      set/show sevenbit-strings set/show print sevenbit-strings
  481.      set/show unionprint       set/show print union
  482.      set/show vtblprint        set/show print vtbl
  483.      
  484.      unset                     [No longer an alias for delete]
  485.  
  486. 
  487. File: gdb.info,  Node: Formatting Documentation,  Next: Installing GDB,  Prev: Renamed Commands,  Up: Top
  488.  
  489. Formatting the Documentation
  490. ****************************
  491.  
  492.    The GDB 4 release includes an already-formatted reference card,
  493. ready for printing on a PostScript or GhostScript printer, in the `gdb'
  494. subdirectory of the main source directory--in `gdb-4.5/gdb/refcard.ps'
  495. of the version 4.5 release.  If you have a PostScript or GhostScript
  496. printer, you can print the reference card by just sending `refcard.ps'
  497. to the printer.
  498.  
  499.    The release also includes the source for the reference card.  You
  500. can format it, using TeX, by typing:
  501.  
  502.      make refcard.dvi
  503.  
  504.    The GDB reference card is designed to print in landscape mode on US
  505. "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
  506. high.  You will need to specify this form of printing as an option to
  507. your DVI output program.
  508.  
  509.    All the documentation for GDB comes as part of the machine-readable
  510. distribution.  The documentation is written in Texinfo format, which is
  511. a documentation system that uses a single source file to produce both
  512. on-line information and a printed manual.  You can use one of the Info
  513. formatting commands to create the on-line version of the documentation
  514. and TeX (or `texi2roff') to typeset the printed version.
  515.  
  516.    GDB includes an already formatted copy of the on-line Info version
  517. of this manual in the `gdb' subdirectory.  The main Info file is
  518. `gdb-VERSION-NUMBER/gdb/gdb.info', and it refers to subordinate files
  519. matching `gdb.info*' in the same directory.
  520.  
  521.    If you want to format these Info files yourself, you need one of the
  522. Info formatting programs, such as `texinfo-format-buffer' or
  523. `makeinfo'.
  524.  
  525.    If you have `makeinfo' installed, and are in the top level GDB
  526. source directory (`gdb-4.5', in the case of version 4.5), you can make
  527. the Info file by typing:
  528.  
  529.      cd gdb
  530.      make gdb.info
  531.  
  532.    If you want to typeset and print copies of this manual, you need
  533. TeX, a printing program such as `lpr', and `texinfo.tex', the Texinfo
  534. definitions file.
  535.  
  536.    TeX is typesetting program; it does not print files directly, but
  537. produces output files called DVI files.  To print a typeset document,
  538. you need a program to print DVI files.  If your system has TeX
  539. installed, chances are it has such a program.  The precise command to
  540. use depends on your system; `lpr -d' is common; another is `dvips'. 
  541. The DVI print command may require a file name without any extension or
  542. a `.dvi' extension.
  543.  
  544.    TeX also requires a macro definitions file called `texinfo.tex'. 
  545. This file tells TeX how to typeset a document written in Texinfo
  546. format.  On its own, TeX cannot read, much less typeset a Texinfo
  547. file.  `texinfo.tex' is distributed with GDB and is located in the
  548. `gdb-VERSION-NUMBER/texinfo' directory.
  549.  
  550.    If you have TeX and a DVI printer program installed, you can
  551. typeset and print this manual.  First switch to the the `gdb'
  552. subdirectory of the main source directory (for example, to
  553. `gdb-4.5/gdb') and then type:
  554.  
  555.      make gdb.dvi
  556.  
  557. 
  558. File: gdb.info,  Node: Installing GDB,  Next: Copying,  Prev: Formatting Documentation,  Up: Top
  559.  
  560. Installing GDB
  561. **************
  562.  
  563.    GDB comes with a `configure' script that automates the process of
  564. preparing GDB for installation; you can then use `make' to build the
  565. program.
  566.  
  567.    The GDB distribution includes all the source code you need for GDB
  568. in a single directory, whose name is usually composed by appending the
  569. version number to `gdb'.
  570.  
  571.    For example, the GDB version 4.5 distribution is in the `gdb-4.5'
  572. directory.  That directory contains:
  573.  
  574. `gdb-4.5/configure (and supporting files)'
  575.      script for configuring GDB and all its supporting libraries.
  576.  
  577. `gdb-4.5/gdb'
  578.      the source specific to GDB itself
  579.  
  580. `gdb-4.5/bfd'
  581.      source for the Binary File Descriptor library
  582.  
  583. `gdb-4.5/include'
  584.      GNU include files
  585.  
  586. `gdb-4.5/libiberty'
  587.      source for the `-liberty' free software library
  588.  
  589. `gdb-4.5/readline'
  590.      source for the GNU command-line interface
  591.  
  592. `gdb-4.5/glob'
  593.      source for the GNU filename pattern-matching subroutine
  594.  
  595. `gdb-4.5/mmalloc'
  596.      source for the GNU memory-mapped malloc package
  597.  
  598.    The simplest way to configure and build GDB is to run `configure'
  599. from the `gdb-VERSION-NUMBER' source directory, which in this example
  600. is the `gdb-4.5' directory.
  601.  
  602.    First switch to the `gdb-VERSION-NUMBER' source directory if you
  603. are not already in it; then run `configure'.  Pass the identifier for
  604. the platform on which GDB will run as an argument.
  605.  
  606.    For example:
  607.  
  608.      cd gdb-4.5
  609.      ./configure HOST
  610.      make
  611.  
  612. where HOST is an identifier such as `sun4' or `decstation', that
  613. identifies the platform where GDB will run.
  614.  
  615.    This sequence of `configure' and `make' builds the `bfd',
  616. `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself. 
  617. The configured source files, and the binaries, are left in the
  618. corresponding source directories.
  619.  
  620.    `configure' is a Bourne-shell (`/bin/sh') script; if your system
  621. does not recognize this automatically when you run a different shell,
  622. you may need to run `sh' on it explicitly:
  623.  
  624.      sh configure HOST
  625.  
  626.    If you run `configure' from a directory that contains source
  627. directories for multiple libraries or programs, such as the `gdb-4.5'
  628. source directory for version 4.5, `configure' creates configuration
  629. files for every directory level underneath (unless you tell it not to,
  630. with the `--norecursion' option).
  631.  
  632.    You can run the `configure' script from any of the subordinate
  633. directories in the GDB distribution, if you only want to configure
  634. that subdirectory; but be sure to specify a path to it.
  635.  
  636.    For example, with version 4.5, type the following to configure only
  637. the `bfd' subdirectory:
  638.  
  639.      cd gdb-4.5/bfd
  640.      ../configure HOST
  641.  
  642.    You can install `gdb' anywhere; it has no hardwired paths. 
  643. However, you should make sure that the shell on your path (named by
  644. the `SHELL' environment variable) is publicly readable.  Remember that
  645. GDB uses the shell to start your program--some systems refuse to let
  646. GDB debug child processes whose programs are not readable.
  647.  
  648. * Menu:
  649.  
  650. * Separate Objdir::             Compiling GDB in another directory
  651. * Config Names::                Specifying names for hosts and targets
  652. * configure Options::           Summary of options for configure
  653.  
  654. 
  655. File: gdb.info,  Node: Separate Objdir,  Next: Config Names,  Prev: Installing GDB,  Up: Installing GDB
  656.  
  657. Compiling GDB in Another Directory
  658. ==================================
  659.  
  660.    If you want to run GDB versions for several host or target machines,
  661. you'll need a different `gdb' compiled for each combination of host
  662. and target.  `configure' is designed to make this easy by allowing you
  663. to generate each configuration in a separate subdirectory, rather than
  664. in the source directory.  If your `make' program handles the `VPATH'
  665. feature (GNU `make' does), running `make' in each of these directories
  666. then builds the `gdb' program specified there.
  667.  
  668.    To build `gdb' in a separate directory, run `configure' with the
  669. `--srcdir' option to specify where to find the source.  (You'll also
  670. need to specify a path to find `configure' itself from your working
  671. directory.  If the path to `configure' would be the same as the
  672. argument to `--srcdir', you can leave out the `--srcdir' option; it
  673. will be assumed.)
  674.  
  675.    For example, with version 4.5, you can build GDB in a separate
  676. directory for a Sun 4 like this:
  677.  
  678.      cd gdb-4.5
  679.      mkdir ../gdb-sun4
  680.      cd ../gdb-sun4
  681.      ../gdb-4.5/configure sun4
  682.      make
  683.  
  684.    When `configure' builds a configuration using a remote source
  685. directory, it creates a tree for the binaries with the same structure
  686. (and using the same names) as the tree under the source directory.  In
  687. the example, you'd find the Sun 4 library `libiberty.a' in the
  688. directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
  689.  
  690.    One popular use for building several GDB configurations in separate
  691. directories is to configure GDB for cross-compiling (where GDB runs on
  692. one machine--the host--while debugging programs that run on another
  693. machine--the target).  You specify a cross-debugging target by giving
  694. the `--target=TARGET' option to `configure'.
  695.  
  696.    When you run `make' to build a program or library, you must run it
  697. in a configured directory--whatever directory you were in when you
  698. called `configure' (or one of its subdirectories).
  699.  
  700.    The `Makefile' generated by `configure' for each source directory
  701. also runs recursively.  If you type `make' in a source directory such
  702. as `gdb-4.5' (or in a separate configured directory configured with
  703. `--srcdir=PATH/gdb-4.5'), you will build all the required libraries,
  704. then build GDB.
  705.  
  706.    When you have multiple hosts or targets configured in separate
  707. directories, you can run `make' on them in parallel (for example, if
  708. they are NFS-mounted on each of the hosts); they will not interfere
  709. with each other.
  710.  
  711. 
  712. File: gdb.info,  Node: Config Names,  Next: configure Options,  Prev: Separate Objdir,  Up: Installing GDB
  713.  
  714. Specifying Names for Hosts and Targets
  715. ======================================
  716.  
  717.    The specifications used for hosts and targets in the `configure'
  718. script are based on a three-part naming scheme, but some short
  719. predefined aliases are also supported.  The full naming scheme encodes
  720. three pieces of information in the following pattern:
  721.  
  722.      ARCHITECTURE-VENDOR-OS
  723.  
  724.    For example, you can use the alias `sun4' as a HOST argument or in
  725. a `--target=TARGET' option, but the equivalent full name is
  726. `sparc-sun-sunos4'.
  727.  
  728.    The following table shows all the architectures, hosts, and OS
  729. prefixes that `configure' recognizes in GDB version 4.5.  Entries in
  730. the "OS prefix" column ending in a `*' may be followed by a release
  731. number.
  732.  
  733.  
  734.      ARCHITECTURE  VENDOR                     OS prefix
  735.      ------------+--------------------------+---------------------------
  736.                  |                          |
  737.       580        | altos        hp          | aix*          msdos*
  738.       a29k       | amd          ibm         | amigados      newsos*
  739.       alliant    | amdahl       intel       | aout          nindy*
  740.       arm        | aout         isi         | bout          osf*
  741.       c1         | apollo       little      | bsd*          sco*
  742.       c2         | att          mips        | coff          sunos*
  743.       cray2      | bcs          motorola    | ctix*         svr4
  744.       h8300      | bout         ncr         | dgux*         sym*
  745.       i386       | bull         next        | dynix*        sysv*
  746.       i860       | cbm          nyu         | ebmon         ultrix*
  747.       i960       | coff         sco         | esix*         unicos*
  748.       m68000     | convergent   sequent     | hds           unos*
  749.       m68k       | convex       sgi         | hpux*         uts
  750.       m88k       | cray         sony        | irix*         v88r*
  751.       mips       | dec          sun         | isc*          vms*
  752.       ns32k      | encore       unicom      | kern          vxworks*
  753.       pyramid    | gould        utek        | mach*
  754.       romp       | hitachi      wrs         |
  755.       rs6000     |                          |
  756.       sparc      |                          |
  757.       tahoe      |                          |
  758.       tron       |                          |
  759.       vax        |                          |
  760.       xmp        |                          |
  761.       ymp        |                          |
  762.  
  763.      *Warning:* `configure' can represent a very large number of
  764.      combinations of architecture, vendor, and OS.  There is by no
  765.      means support available for all possible combinations!
  766.  
  767.    The `configure' script accompanying GDB does not provide any query
  768. facility to list all supported host and target names or aliases. 
  769. `configure' calls the Bourne shell script `config.sub' to map
  770. abbreviations to full names; you can read the script, if you wish, or
  771. you can use it to test your guesses on abbreviations--for example:
  772.  
  773.      % sh config.sub sun4
  774.      sparc-sun-sunos4
  775.      % sh config.sub sun3
  776.      m68k-sun-sunos4
  777.      % sh config.sub decstation
  778.      mips-dec-ultrix
  779.      % sh config.sub hp300bsd
  780.      m68k-hp-bsd
  781.      % sh config.sub i386v
  782.      i386-none-sysv
  783.      % sh config.sub i786v
  784.      *** Configuration "i786v" not recognized
  785.  
  786. `config.sub' is also distributed in the GDB source directory
  787. (`gdb-4.5', for version 4.5).
  788.  
  789. 
  790. File: gdb.info,  Node: configure Options,  Prev: Config Names,  Up: Installing GDB
  791.  
  792. `configure' Options
  793. ===================
  794.  
  795.    Here is a summary of all the `configure' options and arguments that
  796. you might use for building GDB:
  797.  
  798.      configure [--srcdir=PATH]
  799.                [--norecursion] [--rm]
  800.                [--target=TARGET] HOST
  801.  
  802. You may introduce options with a single `-' rather than `--' if you
  803. prefer; but you may abbreviate option names if you use `--'.
  804.  
  805. `--srcdir=PATH'
  806.      *Warning: using this option requires GNU `make', or another
  807.      `make' that implements the `VPATH' feature.*
  808.       Use this option to make configurations in directories separate
  809.      from the GDB source directories.  Among other things, you can use
  810.      this to build (or maintain) several configurations
  811.      simultaneously, in separate directories.  `configure' writes
  812.      configuration specific files in the current directory, but
  813.      arranges for them to use the source in the directory PATH. 
  814.      `configure' will create directories under the working directory
  815.      in parallel to the source directories below PATH.
  816.  
  817. `--norecursion'
  818.      Configure only the directory level where `configure' is executed;
  819.      do not propagate configuration to subdirectories.
  820.  
  821. `--rm'
  822.      Remove the configuration that the other arguments specify.
  823.  
  824. `--target=TARGET'
  825.      Configure GDB for cross-debugging programs running on the
  826.      specified TARGET.  Without this option, GDB is configured to debug
  827.      programs that run on the same machine (HOST) as GDB itself.
  828.  
  829.      There is no convenient way to generate a list of all available
  830.      targets.
  831.  
  832. `HOST ...'
  833.      Configure GDB to run on the specified HOST.
  834.  
  835.      There is no convenient way to generate a list of all available
  836.      hosts.
  837.  
  838. `configure' accepts other options, for compatibility with configuring
  839. other GNU tools recursively; but these are the only options that
  840. affect GDB or its supporting libraries.
  841.  
  842.